using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using BusinessEntity;
using ToolsLayer;
using Webcar.BLL;
using Webcar.Interface;
using System.Web.Script.Services;
namespace Webcar
{
    public partial class login : UserControlBase
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            
        }

        public string UserNameClientID
        {
            get
            {
                return this.UserName.ClientID; 
            }
        }
        public string UserIDClientID
        {
            get
            {
                return this.UserID.ClientID;
            }
        }
        public string UserDeptClientID
        {
            get
            {
                return this.tbDeptName.ClientID;
            }
        }

        public string ReturnUrl
        {
            get
            {
                if (ViewState["returnurl"] == null)
                {
                    return "index.aspx";
                }
                else
                    return ViewState["returnurl"].ToString(); 
            }
        }

        protected void ImageButton1_Click(object sender, ImageClickEventArgs e)
        {
            //UserBLL user = new UserBLL();
            

            try
            {
                string userid = Request["UserID"];
                string pass = Request["Password"];

                UserBLL.Login(userid, pass);
                
                
                //user.ResetLogin(this.UserID.Text);
                FormsAuthentication.RedirectFromLoginPage(userid,
                    true);
            }
            catch(Exception ex)
            {
                Session["err"] = ex.Message;
                Server.Transfer("error.aspx");
            }
        }
    }
}